<template>
  <div>
    <div style="">
      <mt-header title="招聘信息" style="background-color: #ee9900">
        <div slot="left" title="招聘信息">
          <mt-button icon="back" @click="back">返回</mt-button>
        </div>
      </mt-header>
    </div>
    <a-list
      class="demo-loadmore-list"
      :loading="loading"
      itemLayout="horizontal"
      :dataSource="fromData"
    >
      <div v-if="showLoadingMore" slot="loadMore"
           :style="{ textAlign: 'center', marginTop: '12px', height: '32px', lineHeight: '32px' }">
        <a-spin v-if="loadingMore"/>
      </div>
      <a-list-item slot="renderItem" slot-scope="item, index">
        <a-list-item-meta
          :description="item.workPlace"
        >
          <a slot="title" >岗位:{{item.position}} </a>
          <a-avatar slot="avatar" src="@/assets/phone/icon/contract.png"/>
        </a-list-item-meta>
        <div style="display: flex ; flex-direction: column">
          <div>薪酬:{{item.salary}}/月</div>
          <div>学历: {{item.degreeLimit}}</div>
          <div>发布时间: {{item.issueTime}}</div>
        </div>
      </a-list-item>
    </a-list>
  </div>
</template>

<script>
  import * as mint from 'mint-ui';
  import {deleteAction, getAction, downFile, postAction} from '@/api/manage'

  export default {
    name: 'onlineRecruitmentAbsorb',
    components: {
      ...mint,
    },
    methods: {
      back() {
        window.history.go(-1);
      },
      searchData() {

      },
      onLoadMore() {
        this.pageNo++;
        this.loadingMore = true
        getAction(this.url.list, {pageNo: this.pageNo, pageSize: this.pageSize}).then((res) => {
          this.fromData = this.fromData.concat(res.result.records);
          this.loadingMore = false
          this.$nextTick(() => {
            window.dispatchEvent(new Event('resize'))
          })
        })
      },
    },
    mounted() {
      getAction(this.url.list, this.fromData).then((res) => {
        this.loading = false;
        if (res.success) {
          this.fromData = res.result.records;
          console.log(this.fromData);
        }

      })

    }, data() {
      return {
        value: '',
        pageNo: 1,
        pageSize: 10,
        loading: true,
        loadingMore: false,
        showLoadingMore: true,
        fromData: [],
        token: '',
        url: {
          list: '/recruitment/recruitmentAbsorb/list',
        },
      }
    },
  }
</script>

<style>
  .ant-list-item-content {
    display: block;
  }

  .page-search {
    height: 100%;
  }
  .ant-layout-header{
    display: none;
  }

</style>